import random
import hashlib


# md5加密
def get_md5_data(pwd: str, salt=''):
    # 1、创建实例
    md5 = hashlib.md5()
    # 2、调用加密方法
    pwd = pwd + salt  # 拼接盐值
    md5.update(pwd.encode('utf-8'))
    return md5.hexdigest()  # 加密后结果




'''生产随机手机号'''
def random_phone():
    """
    生成随机手机号默认位10位数
    :return:
    """
    random_phone = str(random.randint(1000000000, 9999999999))
    return random_phone


'''随机生成一个邮箱,目前没做限制,随机给个数字邮箱'''
def random_email():
    prefix = str(random.randint(100000,999999))
    suff = "@163"
    random_email = prefix + suff + ".com"
    return random_email

    # if suff == "@163":
    #     random_email = prefix + suff +'.com'
    # elif suff == "@gmail":
    #     random_email = prefix + suff + '.com'
    # elif suff =="@yahoo":
    #     random_email = prefix + suff + '.com'
    # elif suff == "@qq":
    #     random_email = prefix + suff + '.com'
    # return random_email

# if __name__ == '__main__':
# # #     print(type('Chen0307'))
# # #     res = get_md5_data('Chen0307')
# # #     print(res)
# #     q = random_phone()
# #     print(q)
#     q = ['@163','@gmail','@yahoo','@qq']
#     for  i in q:
#        print(random_email(i))
#

if __name__ == '__main__':
    random_email()